-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin: Deprecate gutenberg_can_edit_* functions #13470
Conversation
0b65b9c
to
35db60e
Compare
35db60e
to
c84e4e2
Compare
c84e4e2
to
8e33fd6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
I verified that for this CPT:
function create_product_type() {
register_post_type( 'acme_product',
array(
'label' => 'Product',
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => true,
'show_in_rest' => true,
'supports' => array( 'title' ),
)
);
}
add_action( 'init', 'create_product_type' );
The editor is not loaded, and classic editor opens with just the title field (as before).
If we replace title with editor the editor loads without the option to choose the title.
If we remove the supports array the editor loads normally if we set show_in_rest to false the classic editor starts being used instead.
I also did some grepping and I verified that there are no usages of the deprecated functions.
Related: #11015
This pull request seeks to deprecate the
gutenberg_can_edit_post_type
andgutenberg_can_edit_post
functions in favor of the core-equivalentuse_block_editor_for_post_type
anduse_block_editor_for_post
functions.See:
Testing instructions:
Verify that one can edit a Gutenberg post if and only if the post type and user are capable of editing (e.g.
show_in_rest
, supportseditor
, etc). The logic is not identical in core, and this will continue to be aligned until eventually Gutenberg merely extends theedit-form-blocks.php
interface.The core implementations also use the
meta-box-loader
query parameter for meta boxes, which is not the same as what's used in Gutenberg. However, this is already slated for removal as of #13449.